package controller.user.category;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import model.entity.Category;
import service.Impl.CategoryServiceImpl;
import util.ResultUtil;

import java.io.IOException;
import java.util.List;

@WebServlet("/user/category/type")
public class CategoryListController extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        CategoryServiceImpl service=new CategoryServiceImpl();
        String type=req.getParameter("type");
        List<Category> list=service.type(type);
        String json= ResultUtil.getJSON(list);
        resp.getWriter().write(json);
    }
}
